package com.yanqu.road.entity.admin;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;

public class AdminResult2 {

    private int code;

    private String msg = "操作成功";

    private int historyBanTimes; // 历史封禁次数

    //类型与AdminResult区别
    private JSONArray data = new JSONArray();

    public static AdminResult2 successCode(int code) {
        AdminResult2 result = new AdminResult2();
        result.setCode(code);
        return result;
    }

    public static AdminResult2 failCode(int code, String msg) {
        AdminResult2 result = new AdminResult2();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }

    public static AdminResult2 failMsg(String msg) {
        AdminResult2 result = new AdminResult2();
        result.setCode(-1);
        result.setMsg(msg);
        return result;
    }

    public static AdminResult2 defaultInstance(){
        return new AdminResult2();
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public JSONArray getData() {
        return data;
    }

    public void setData(JSONArray data) {
        this.data = data;
    }

    public String toJsonString(){
        return JSON.toJSONString(this);
    }

    public int getHistoryBanTimes() {
        return historyBanTimes;
    }

    public void setHistoryBanTimes(int historyBanTimes) {
        this.historyBanTimes = historyBanTimes;
    }
}
